package com.srlg.batch.user;

import com.srlg.batch.model.entity.User;
import lombok.extern.slf4j.Slf4j;
import org.springframework.batch.item.ItemProcessor;

@Slf4j
public class UserItemProcessor implements ItemProcessor<User, User> {

    @Override
    public User process(User user) {
        final String name = user.getName().toUpperCase();

        final User u = new User();
        u.setName(name);
        u.setSex(user.getSex());
        u.setAge(user.getAge());
        u.setAddress(user.getAddress());
        u.setStatus(user.getStatus());


        log.info("Converting ({}) into ({})", user, u);

        return u;
    }
}
